package be.vdab.servlets;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import be.vdab.dao.SausenDAO;
import be.vdab.entities.Saus;

/**
 * Servlet implementation class SausServlet
 */
@WebServlet("/sausen")
public class SausServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private static final String VIEW = "WEB-INF/JSP/saus.jsp";
	public final SausenDAO sausenDAO = new SausenDAO();
	private static final String REDIRECT_URL = "/sausen";
	
	
	@Override
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		//List<Saus> sausen = new ArrayList<Saus>();
		/*sausen.add(new Saus(1L, "cocktail",
				new String[] { "mayonaise", "room", "gember", "tomatenketchup",
						"cognac", "sherry", "peper", "zout" }));
		sausen.add(new Saus(2L, "mayonaise", new String[] { "eidooier", "olie",
				"azijn", "mosterd", "kruiden", "peper", "zout" }));
		sausen.add(new Saus(3L, "mosterd", new String[] { "mosterdzaden",
				"azijn", "water", "suiker", "zout", "peper", "mierikswortel" }));
		sausen.add(new Saus(4L, "tartare", new String[] { "mayonaise", "ei",
				"peterselie", "sjalotjes", "augurk", "kappertjes", "bieslook" }));
		sausen.add(new Saus(5L, "vinaigrette", new String[] { "olijfolie",
				"wijnazijn", "zout", "peper", "tuinkruiden", "mosterd",
				"knoflook" }));*/
		request.setAttribute("sausen", sausenDAO.findAll());
		request.getRequestDispatcher(VIEW).forward(request, response);
	}	
}
